<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
	<link href="../../css/general1.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../script/hiawardbpm.js"></script>
    <script type="text/javascript" src="../../script/prototype.js"></script>
    <script type="text/javascript">
      function subForm(){
       var webData=buildWebData();  
       var xmlMsg=new WebProcessMsg();
       xmlMsg.setCommand(9);
       xmlMsg.setAction("/CreateTallyAction");
       xmlMsg.setProcessName('WebProcessTally');
       xmlMsg.setWebData(webData);
       xmlMsg.buildXML();
       var url="/BPM/ProcessAjaxHandler";
       alert(xmlMsg.getXmlDocument().xml);
       new Ajax.Request(url,{
          method:'post',
          postBody:xmlMsg.getXmlDocument().xml,
          contentType:'application/x-www-form-urlencoded',
          encoding:'UTF-8',
          onComplete:function(transport){
	          try{
		          if(200==transport.status){
		               alert('成功创建了一个新任务');
		              }
		          if(400==transport.status){
		               alert('创建失败');
		              }
	          }catch(err){
	              alert('js异常');
	          }
          }
       });
      }
      function buildWebData(){
      var webData=new WebData();
      var accno=document.getElementById('accno').value;
      var amount=document.getElementById('amount').value;
      var vchno=document.getElementById('vchno').value;
      webData.setProperty('accno',accno);
      webData.setProperty('amount',amount);
      webData.setProperty('vchno',vchno);
      return webData;
      }
    </script>
  </head>
  
  <body>
  <table>
    <tr>
      <td>帐号</td>
      <td><input type="text" name="accno" id="accno"/></td>
    </tr>
    <tr>
      <td>金额</td>
      <td><input type="text" name="amount" id="amount"/></td>
    </tr>
    <tr>
      <td>凭证号</td>
      <td><input type="text" name="vchno" id="vchno"/></td>
    </tr>
    <tr>
      <td colspan="2"><input type="button" name="create" value="创建任务" onclick="subForm()"/></td>
    </tr>
    <tr>
      <td colspan="2"><a href="login.html">登录</a></td>
    </tr>
  </table> 
  </body>
</html>
